package com.lc.afbx.conn;

/**
 * Created by Administrator on 2016/6/8.
 */

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
//      团队查询接口
@HttpInlet(Conn.INLET_API_TEAM_SEARCH)
public class GetApiTeamSearch extends BaseAsyGet<GetApiTeamSearch.Info> {

    public String tid,userid;

    public GetApiTeamSearch(AsyCallBack<GetApiTeamSearch.Info> asyCallBack) {
        super(asyCallBack);
    }

    protected Info parser(JSONObject jsonObject) {

        TOAST = jsonObject.optString("message");

        if (jsonObject.optInt("code") == 200) {

            JSONArray array = jsonObject.optJSONArray("data");
            Info info = new Info();
            for (int i = 0; i < array.length(); i++) {

                JSONObject o = array.optJSONObject(i);
                Data d = new Data();

                d.code = o.optString("code");
                d.id = o.optString("id");
                d.nickname = o.optString("nickname");
                d.level = o.optString("level");
                d.sectors = o.optString("sectors");
                d.team_id = o.optString("team_id");
                d.team_state = o.optString("team_state");

                info.dataList.add(d);

            }
            return info;
        }
        return null;
    }

    public static class Info {

        public List<Data> dataList = new ArrayList<>();
    }

    public static class Data implements Serializable {

//        "id": "2",
//                "code": "4870723",
//                "nickname": "李四",
//                "level": "会员",
//                "team_id": "2",
//                "team_state": "true",
//                "sectors": "哈尔滨总公司"
        public String id, code, nickname, level, sectors,team_id,team_state;
    }

}
